//  PULSAR, THE GAME
//  ================================
//  COPYRIGHT(c) 2013 BY KAMIL MRZYGŁÓD
//  CODENOVA.PL

define(function () {
    var WSClient = function() {
        this.Connection = new WebSocket('ws://localhost:8081');
        this.ReadyState = 0;
    };

    WSClient.prototype = {
        AttachEvents: function() {
            var self = this;

            this.Connection.onopen = function(e) {
                // WS is ready
                console.log('Connection established!');
                self.ReadyState = 1;
            };

            this.Connection.onmessage = function(e) {
                console.log(e.data);
            };
        },

        Create: function() {
            return new WSClient();
        }
    };

    return WSClient.prototype.Create;
});